package com.digital.library.modules.system.controller;

import com.digital.library.common.annotation.Log;
import com.digital.library.common.annotation.Permission;
import com.digital.library.common.utils.RedisUtil;
import com.digital.library.common.vo.Result;
import com.digital.library.modules.system.domain.SysUser;
import com.digital.library.modules.system.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/test")
public class HelloWorldController {

    @Autowired
    private SysUserService sysUserService;

    @Autowired
    RedisUtil redisUtil;

    @GetMapping(value = "/hello")
    @Permission(permission = "1")
    @Log
    public Result<?> hello(@RequestParam(name = "name") String name){
        System.out.println("Hello " + name);

        List<SysUser> sysUserList = sysUserService.all();
        return Result.ok(sysUserList);
    }

}
